import { Injectable } from "@nestjs/common";
import { Repository } from "typeorm";
import { UserEntity } from "./user.entity";
import { InjectRepository } from "@nestjs/typeorm";

@Injectable()
export class UserService{
    constructor(
        @InjectRepository(UserEntity)
        private readonly userService:Repository<UserEntity>
    ){}
    async find(){
        return await this.userService.find()
    }
    async findOne(userId){
        return await this.userService.findOne(userId);
    }
    async add(user){
        return await this.userService.create(user)
    }
    async remove(userId){
        return await this.userService.delete(userId)
    }
    async update(user){
        return await this.userService.update(user.userId,user)
    }
}